package daobeauty.dao;

/**
 * Created 16.09.2008
 * @author M. Serhat Cinar
 *
 */
public class Limiting {
	private int maxResults;
	private int offset = 0;
	
	/**
	 * @param maxResults
	 */
	public Limiting(int maxResults) {
		super();
		this.maxResults = maxResults;
	}
	/**
	 * @param maxResults
	 * @param offset
	 */
	public Limiting(int maxResults, int offset) {
		super();
		this.maxResults = maxResults;
		this.offset = offset;
	}
	/**
	 * @return the maxResults
	 */
	public int getMaxResults() {
		return maxResults;
	}
	/**
	 * @param maxResults the maxResults to set
	 */
	public void setMaxResults(int maxResults) {
		this.maxResults = maxResults;
	}
	/**
	 * @return the offset
	 */
	public int getOffset() {
		return offset;
	}
	/**
	 * @param offset the offset to set
	 */
	public void setOffset(int offset) {
		this.offset = offset;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int PRIME = 31;
		int result = 1;
		result = PRIME * result + maxResults;
		result = PRIME * result + offset;
		return result;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) return true;
		if (obj == null) return false;
		if (getClass() != obj.getClass()) return false;
		final Limiting other = (Limiting) obj;
		if (maxResults != other.maxResults) return false;
		if (offset != other.offset) return false;
		return true;
	}
	
	public String toString(){
		return "MAX "+maxResults+" OFFSET "+offset;
	}
}
